home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / html / HTMLDocument$HTMLReader$HeadAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.7 KB  |  94 lines

  1. package javax.swing.text.html;
  2.  
  3. import javax.swing.text.AttributeSet;
  4. import javax.swing.text.MutableAttributeSet;
  5. import javax.swing.text.html.HTML.Attribute;
  6. import javax.swing.text.html.HTML.Tag;
  7. import javax.swing.text.html.HTMLDocument.HTMLReader;
  8.  
  9. class HTMLDocument$HTMLReader$HeadAction extends HTMLDocument.HTMLReader.HiddenAction {
  10.    // $FF: synthetic field
  11.    private final HTMLDocument.HTMLReader this$1;
  12.  
  13.    HTMLDocument$HTMLReader$HeadAction(HTMLDocument.HTMLReader var1) {
  14.       super(var1);
  15.       this.this$1 = var1;
  16.    }
  17.  
  18.    public void end(HTML.Tag var1) {
  19.       this.this$1.inHead = this.this$1.inStyle = false;
  20.       if (this.this$1.styles != null) {
  21.          boolean var2 = this.this$1.isStyleCSS;
  22.          int var3 = 0;
  23.          int var4 = this.this$1.styles.size();
  24.  
  25.          while(var3 < var4) {
  26.             Object var5 = this.this$1.styles.elementAt(var3);
  27.             if (var5 == Tag.LINK) {
  28.                ++var3;
  29.                this.handleLink((AttributeSet)this.this$1.styles.elementAt(var3));
  30.                ++var3;
  31.             } else {
  32.                ++var3;
  33.                String var6 = (String)this.this$1.styles.elementAt(var3);
  34.                boolean var7 = var6 == null ? var2 : var6.equals("text/css");
  35.  
  36.                while(true) {
  37.                   ++var3;
  38.                   if (var3 >= var4 || !(this.this$1.styles.elementAt(var3) instanceof String)) {
  39.                      break;
  40.                   }
  41.  
  42.                   if (var7) {
  43.                      this.this$1.addCSSRules((String)this.this$1.styles.elementAt(var3));
  44.                   }
  45.                }
  46.             }
  47.          }
  48.       }
  49.  
  50.       if (this.this$1.insertTag == null || this.this$1.insertTag == Tag.HEAD) {
  51.          super.end(var1);
  52.       }
  53.  
  54.    }
  55.  
  56.    private void handleLink(AttributeSet var1) {
  57.       String var2 = (String)var1.getAttribute(Attribute.TYPE);
  58.       if (var2 == null) {
  59.          var2 = HTMLReader.access$0(this.this$1).getDefaultStyleSheetType();
  60.       }
  61.  
  62.       if (var2.equals("text/css")) {
  63.          String var3 = (String)var1.getAttribute(Attribute.REL);
  64.          String var4 = (String)var1.getAttribute(Attribute.TITLE);
  65.          String var5 = (String)var1.getAttribute(Attribute.MEDIA);
  66.          if (var5 == null) {
  67.             var5 = "all";
  68.          } else {
  69.             var5 = var5.toLowerCase();
  70.          }
  71.  
  72.          if (var3 != null) {
  73.             var3 = var3.toLowerCase();
  74.             if ((var5.indexOf("all") != -1 || var5.indexOf("screen") != -1) && (var3.equals("stylesheet") || var3.equals("alternate stylesheet") && var4.equals(this.this$1.defaultStyle))) {
  75.                this.this$1.linkCSSStyleSheet((String)var1.getAttribute(Attribute.HREF));
  76.             }
  77.          }
  78.       }
  79.  
  80.    }
  81.  
  82.    boolean isEmpty(HTML.Tag var1) {
  83.       return false;
  84.    }
  85.  
  86.    public void start(HTML.Tag var1, MutableAttributeSet var2) {
  87.       this.this$1.inHead = true;
  88.       if (this.this$1.insertTag == null || this.this$1.insertTag == Tag.HEAD) {
  89.          super.start(var1, var2);
  90.       }
  91.  
  92.    }
  93. }
  94.